package com.shandao.shangxiu.fragment;

import android.view.View;

import com.shandao.shangxiu.R;
import com.shandao.shangxiu.adapter.HomePagerViewPagerAdapter;
import com.shandao.shangxiu.autoscrollviewpager.AutoScrollViewPager;
import com.shandao.shangxiu.autoscrollviewpager.viewpagerindicator.LinePageIndicator;
import com.shandao.shangxiu.base.BaseFragment;
import com.shandao.shangxiu.bean.entity.Banner;

import java.util.ArrayList;
import java.util.List;


public class HomeFragment extends BaseFragment {
    private AutoScrollViewPager autoScrollViewPager;// 自动滚动viewpager
    private LinePageIndicator indicator;
    private HomePagerViewPagerAdapter adapter;
    private List<Banner> datas;

    private int[] images = new int[] { R.mipmap.a, R.mipmap.b,
            R.mipmap.c, R.mipmap.d, R.mipmap.e, R.mipmap.f};

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_home;
    }

    public void initView(View view) {
        autoScrollViewPager = (AutoScrollViewPager) view.findViewById(R.id.asv);
        indicator = (LinePageIndicator) view.findViewById(R.id.indicator);
    }

    public void initData() {
        datas = new ArrayList<>();
        adapter  = new HomePagerViewPagerAdapter(getActivity(),datas);
        autoScrollViewPager.setAdapter(adapter);
        autoScrollViewPager.startAutoScroll(3000);
        indicator.setViewPager(autoScrollViewPager);
    }


    @Override
    public void onClick(View view) {

    }
}